<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>添加/修改调查统计季度（整改表）</title>
<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/bootstrap.min.css?v=3.3.5"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/font-awesome.min.css?v=4.4.0"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/animate.min.css"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/style.min.css?v=4.0.0"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/plugins/toastr/toastr.min.css"
	rel="stylesheet">

<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/plugins/iCheck/custom.css"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/views/sysdefault/css/table_style.css"
	rel="stylesheet">
</head>

<body class="gray-bg">

<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<!-- <h5>添加/修改新闻</h5>
						<div class="ibox-tools">
							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
							</a>
						</div> -->
						<ul class="nav nav-tabs">
							<li class="active"><a data-toggle="tab" href="#tab-1"><i
									class="fa fa-user"></i>临桂公安局民警动态管理调查统计季报表（变更表）（表三）</a></li>

						</ul>
					</div>

					<div class="ibox-content">
						<input type="hidden" id="fileUploadIp" value="${fileUploadIp}" />
						<input type="hidden" id="typeInfo" value="${cateMap}" /> <input
							type="hidden" id="imageInfo" value="${news.imageUrl}" />
						<form
							action="<%=request.getContextPath()%>/bgGlutTableThreeChange/addTable.do"
							id="subForm" method="post" class="form-horizontal"
							onsubmit="return beforeSub();" enctype="multipart/form-data">
							<input type="hidden" id="mainCateId" name="mainCateId"
								value="${dataStore.mainCateId}" /> <input type="hidden"
								id="newsId" name="newsId" value="${news.newsId}" /> <input
								type="hidden" id="status" name="status" value="1" />

							<div class="table-responsive tab-content">

								<!-- *************新闻tab页**************** -->
								<div id="tab-1" class="tab-pane active">
									<div class="full-height-scroll">
										<div class="form-group col-lg-6 col-sm-12">
											<label class="col-sm-3 control-label">呈报单位及呈报人:</label>
											<label class="col-sm-3 control-label">呈报单位及呈报人</label>
										</div>
										<div class="form-group col-lg-6 col-sm-12" id="data_1">
											<label class="control-label col-sm-2">填报日期</label>
											<label class="col-sm-2 control-label time"></label>
										</div>
										<div class="col-lg-12">
											<table class="table table-bordered">
												<tr>
													<td class="label_style col-lg-2" rowspan="2" >第一季度</td>												
													<td class="label_style col-lg-2">有无变动</td>
													<td class="label_style col-lg-8" style="padding:0px">
													<input type="text" name="cbname"
													placeholder="建议在10字以内。" class="table_input_style"
													required=""
													onkeyup="javascript:setShowLength(this, 100, 'cost_tpl_title_length');"
													maxlength="20"> 
													</td>
													
												</tr>
												<tr>
													<td class="label_style">具体说明</td>
													<td style="padding:0px">
													<input type="text" name="cbname"
													placeholder="建议在10字以内。" class="table_input_style"
													required=""
													onkeyup="javascript:setShowLength(this, 100, 'cost_tpl_title_length');"
													maxlength="20"> 
													</td>
												</tr>
												
												<tr>
													<td class="label_style" rowspan="2" >其他说明</td>												
													<td class="label_style" rowspan="2" colspan="2">
													<textarea class="form-control text_style" rows="2"></textarea>
													</td>
													
													
												</tr>
												
												
											</table>
										</div>



									</div>
								</div>

							</div>



							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-12">
									<button class="btn btn-primary pull-right m-t-n-xs" id="save"
										type="submit">发布</button>
									<button style="margin-right: 10px;"
										class="btn btn-warning pull-right m-t-n-xs"
										onclick="drafts();">保存至草稿箱</button>
								</div>
							</div>
						</form>

					</div>
				</div>
			</div>
		</div>
	</div>
</body>

	<script type="text/javascript">
		//var fileUploadIp = $("#fileUploadIp").val();
		window.UEDITOR_UPLOAD_URL = '<%=request.getAttribute("fileUploadIp")%>';
	</script>

	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/jquery.min.js?v=2.1.4"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/bootstrap.min.js?v=3.3.5"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/content.min.js?v=1.0.0"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/toastr/toastr.min.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/layer/layer.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/iCheck/icheck.min.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/views/sysdefault/js/uploadPreview.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/clockpicker/clockpicker.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/plugins/cropper/cropper.min.js"></script>
	<script
		src="<%=request.getContextPath()%>/views/sysdefault/js/demo/form-advanced-demo.min.js"></script>
	<!-- 富文本编辑器 -->
	<script type="text/javascript" charset="utf-8"
		src="<%=request.getContextPath()%>/views/sysdefault/plugins/uEditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="<%=request.getContextPath()%>/views/sysdefault/plugins/uEditor/ueditor.all.min.js"> </script>
	<script type="text/javascript" charset="utf-8"
		src="<%=request.getContextPath()%>/views/sysdefault/plugins/uEditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript">
	     $(".group_style").each(function(){	    	
	    	 var height=$(this).height();
	    	 
	    	$(this).children().each(function(){
	    		/*  $(this).css("height":height); */
	    		$(this).height(height)	    	
	    	})	    		    	
	    });	     
	     $(".groupchild").each(function(){	    	
	    	 var height=$(this).height(); 
	    	
	    	  $(this).children().each(function(){
	    		  
		    		$(this).height(height-2); 
		    	
		    	})	 
	    	    		    	
	    });
	     $(".text_style").each(function(){	    	
	    	 var height=$(this).parent().height(); 
	    	 $(this).height(height);
	    	    		    	
	    });
	     $(".time").html(function getNowFormatDate() {
	    	    var date = new Date();
	    	    var seperator1 = "年";
	    	    var seperator2 = "月";
	    	    var month = date.getMonth() + 1;
	    	    var strDate = date.getDate();
	    	    if (month >= 1 && month <= 9) {
	    	        month = "0" + month;
	    	    }
	    	    if (strDate >= 0 && strDate <= 9) {
	    	        strDate = "0" + strDate;
	    	    }
	    	    var currentdate = date.getFullYear() + seperator1 + month + seperator2 
	    	    return currentdate;
	    });
	</script>
	<script type="text/javascript">
    
    var basePath = '<%=request.getContextPath()%>
		';

		var imgId = "";
		var inputId = "";

		//初始化富文本编辑器
		var ue = UE.getEditor('editor');

		toastr.options = {
			"closeButton" : true,
			"debug" : false,
			"progressBar" : true,
			"positionClass" : "toast-top-left",
			"showDuration" : "400",
			"hideDuration" : "1000",
			"timeOut" : "3000",
			"extendedTimeOut" : "1000",
			"showEasing" : "swing",
			"hideEasing" : "linear",
			"showMethod" : "fadeIn",
			"hideMethod" : "fadeOut"
		}

		function setShowLength(obj, maxlength, id) {
			var rem = maxlength - obj.value.length;
			var wid = id;
			if (rem < 0) {
				rem = 0;
			}
			document.getElementById(wid).innerHTML = "还可以输入" + rem + "个字符";
		}

		//初始化页面
		$(function() {

			//新闻栏目回显
			var typeInfo = $("#typeInfo").val();
			if (typeInfo != '') {
				var typeInfoList = typeInfo.split(',');
				$("input[name='type']").each(function(i, item) {
					var typeVal = $(this).val();
					var type_self = $(this);
					for ( var typeItem in typeInfoList) {
						if (typeInfoList[typeItem] == typeVal) {
							type_self.attr('checked', true);
							return true;
						}
					}
				});
			}

			//新闻封面图片回显
			var imageInfo = $("#imageInfo").val();
			if (imageInfo != '') {
				$("#imgShow_1").attr("src", imageInfo);
				$("#up_img_1").val(imageInfo);
			}

			$(".i-checks").iCheck({
				checkboxClass : "icheckbox_square-green",
				radioClass : "iradio_square-green",
			});

			new uploadPreview({
				UpBtn : "up_img_1",
				DivShow : "imgdiv_1",
				ImgShow : "imgShow_1"
			});

			new uploadPreview({
				UpBtn : "up_img_6",
				DivShow : "imgdiv_6",
				ImgShow : "imgShow_6"
			});

			new uploadPreview({
				UpBtn : "up_img_7",
				DivShow : "imgdiv_7",
				ImgShow : "imgShow_7"
			});

			//禁止后退键 作用于Firefox、Opera
			document.onkeypress = banBackSpace;
			//禁止后退键  作用于IE、Chrome
			document.onkeydown = banBackSpace;
		});

		var clickImg = function(mInputId, mImgId, imgageCompress) {
			inputId = mInputId;
			imgId = mImgId;

			layer.open({
				type : 2,
				title : "上传图片",
				fix : false, //不固定
				maxmin : false,
				shadeClose : true,
				shade : 0.3,
				area : [ '600px', '430px' ],
				content : basePath + '/common/selectImage.dop?imageCompress='
						+ imgageCompress
			});
		}

		//提交表单前校验
		function beforeSub() {

			//校验新闻栏目
			var newsAllType = $("input[name='type']");
			if (newsAllType.length > 0) {
				var newsType = $("input[name='type']:checked");
				if (newsType.length == 0) {
					toastr.warning("至少选择一个新闻栏目！", "提示");
					return false;
				}

			}

			return true;
		}

		//响应保存至草稿箱
		var drafts = function() {
			document.getElementById("status").value = 3;
			document.getElementById("save").click();
		}

		//弹出框选择回调函数
		var selectCallBack2 = function(data) {
			debugger;
			var obj = jQuery.parseJSON(data);
			var imgList = obj.image.split(',');
			if (imgList.length > 0) {
				$("#" + inputId).val(imgList[0]);
				$("#" + imgId).attr("src", imgList[0]);
			}
			layer.closeAll();
		}

		//处理键盘事件 禁止后退键（Backspace）密码或单行、多行文本框除外
		function banBackSpace(e) {
			var ev = e || window.event;//获取event对象   
			var obj = ev.target || ev.srcElement;//获取事件源   
			var t = obj.type || obj.getAttribute('type');//获取事件源类型  
			//获取作为判断条件的事件类型
			var vReadOnly = obj.getAttribute('readonly');
			//处理null值情况
			vReadOnly = (vReadOnly == "") ? false : vReadOnly;
			//当敲Backspace键时，事件源类型为密码或单行、多行文本的，
			//并且readonly属性为true或enabled属性为false的，则退格键失效
			var flag1 = (ev.keyCode == 8
					&& (t == "password" || t == "text" || t == "textarea") && vReadOnly == "readonly") ? true
					: false;
			//当敲Backspace键时，事件源类型非密码或单行、多行文本的，则退格键失效
			var flag2 = (ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea") ? true
					: false;

			//判断
			if (flag2) {
				return false;
			}
			if (flag1) {
				return false;
			}
		}
	</script>


</html>